﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Alex.Library.Cloud.Libs
{
    /// <summary>
    /// Virtual Machine Managed Provider.
    /// </summary>
    public interface IVMMProvider
    {
        /// <summary>
        /// Provider Version
        /// </summary>
        string Version { get; }
        /// <summary>
        /// provider's capability(method's name in provider);
        /// </summary>
        List<string> Capability { get; }
        /// <summary>
        /// Connect to Server.
        /// </summary>
        /// <param name="arg">connect arguments.</param>
        /// <param name="action">an action when connected. the argument is connection object(example: VMWareApiProvider is AppUtil object).</param>
        /// <returns></returns>
        bool Connect(IVMMParameter arg, Action<object> action);
        /// <summary>
        /// Connect to Server.
        /// </summary>
        /// <param name="arg">connection arguments.</param>
        /// <returns></returns>
        bool Connect(IVMMParameter arg);
        /// <summary>
        /// Create an User.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool CreateUser(IVMMParameter arg);
        /// <summary>
        /// Create an Virtual Machine.
        /// </summary>
        /// <param name="arg">argument for this method.</param>
        /// <returns></returns>
        bool CreateVM(IVMMParameter arg);
        /// <summary>
        /// start an virtual machine
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool StartVM(IVMMParameter arg);
        /// <summary>
        /// shutdown guest os(not power off)
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool ShutdownGuest(IVMMParameter arg);
        /// <summary>
        /// reboot guest os.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool RebootGuest(IVMMParameter arg);
        /// <summary>
        /// reset(foce power state change) an virtual machine.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool ResetVM(IVMMParameter arg);
        /// <summary>
        /// power off an virtual machine.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool PowerOffVM(IVMMParameter arg);
        /// <summary>
        /// suspend(or save) an virtual machine.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool SuspendVM(IVMMParameter arg);
        /// <summary>
        /// resume an suspend vm.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool ResumeVM(IVMMParameter arg);
        /// <summary>
        /// standby guest os.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool StandbyGuest(IVMMParameter arg);
        /// <summary>
        /// Clone an Virtual Machine.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool CloneVM(IVMMParameter arg);
        /// <summary>
        /// Delete an Virtual Machine.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool DeleteVM(IVMMParameter arg);
        /// <summary>
        /// get an virtual machine reference from an ESX/ESXi Server or vCenter.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        IVMReference FindVM(IVMMParameter arg);
        /// <summary>
        /// get all virtual machines from an ESX/ESXi Server or vCenter.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        List<IVMReference> ListVM(IVMMParameter arg);
        /// <summary>
        /// get all template virtual machines from an ESX/ESXi Server or vCenter.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        List<IVMReference> ListTemplateVM(IVMMParameter arg);
        /// <summary>
        /// Create an Virtual Machine Snapshot.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool CreateSnapshot(IVMMParameter arg);
        /// <summary>
        /// list virtual machine's snapshots.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        List<IVMSnapshotReference> ListSnapshot(IVMMParameter arg);
        /// <summary>
        /// revert virtual machine from an snapshot.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool RevertSnapshot(IVMMParameter arg);
        /// <summary>
        /// remove an vitrual machine's snapshot.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool RemoveSnapshot(IVMMParameter arg);
        /// <summary>
        /// remove all virtual machine's snapshot.
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        bool ClearSnapshot(IVMMParameter arg);
    }
}
